﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Common_AdminLogin : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void login_btn_Click(object sender, EventArgs e)
    {
        SQL sql = new SQL();
        string p1=sql.EXQSQL("SELECT ADMINPASSWORD FROM ADMIN_INFO WHERE ADMINID='" + username.Text + "'");
        string p2 = sql.EXQSQL("SELECT systemAdminPassword FROM SystemAdmin WHERE systemAdminID='" + username.Text + "'");
        if (password.Text.Equals(p1))
        {
            Session["admin"] = username.Text;
            Response.Write("<script language=javascript>alert('登陆成功');window.location = '../Manager/AdminIndex.aspx';</script>"); 

        }
        else if (password.Text.Equals(p2))
        {
            Session["system"] = username.Text;
            Response.Write("<script language=javascript>alert('登陆成功');window.location = '../Admin/AdminIndex.aspx';</script>"); 
        }
        else
        {
            Response.Write("<script language=javascript>alert('登陆失败');window.location = 'AdminLogin.aspx';</script>"); 
        }
    }
}